package gof_003_行为型_Behavioral.gof_005_责任链_ChainOfResponsibility.gof_004_Chain;

import java.util.Scanner;
import java.util.concurrent.TimeUnit;

public class Utils {

    /**
     * 睡眠几秒
     *
     * @param seconds
     */
    public static void sleep(int seconds) {
        try {
            TimeUnit.SECONDS.sleep(seconds);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    /**
     * 从控制台输入信息,模拟选择
     *
     * @return
     */
    public static int scanner(String tip) {
        System.out.println(tip);
        Scanner scanner = new Scanner(System.in);
        int i = scanner.nextInt();
        return i;
    }

    public static boolean randomFlag() {
        int random = (int) (Math.random() * (100 - 0 + 1)) + 0;
        return random <= 50;
    }
}